<?php

/**
 * @Author: zhibinm (113664000@qq.com)
 * @Date:   2018-04-13 14:38:25 
 * @Copyright:   xuebingsi
 * @Last Modified by:   Zhibinm
 * @Last Modified time: 2018-04-20 08:33:02
 */
include './common.php';

$data = $_POST;


$data['ctime'] = time();

$data['password'] = md5($data['password']);

$oldUser = getData('./db/user.txt');

foreach ($oldUser as  $user) {
	if($data['username']==$user['username']){
		notice('./reg.php',"用户已存在，请重新输入",false,2);
	}
}

$oldUser[] = $data;

putData($oldUser,'./db/user.txt');

notice('./login.php',"注册成功");






